package com.gimi.cloud.bbp.dao.dao.order;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.gimi.cloud.bbp.dao.myMapper.MyMapper;
import com.gimi.cloud.bbp.dto.order.OrderGoodsDTO;
import com.gimi.cloud.bbp.entity.order.OrderGoodsEntity;
/**
 * 订单操作信息dao
 * @author chendi
 * @date 2018年1月10日
 */
@Mapper
public interface OrderGoodsDao extends MyMapper<OrderGoodsEntity>{
	
	@Update("UPDATE sh_order_goods SET is_delete = 1 WHERE o_id = #{oId}")
	int deleteByOrderId(@Param(value = "oId")Integer oId);
	
	@Select("SELECT * FROM sh_order_goods WHERE is_delete = 0 AND o_id = #{oId}")
	List<OrderGoodsDTO> getGoodsbyOrderId(@Param(value = "oId")Integer oId);
	
	@Select("SELECT * FROM sh_order_goods is_delete = 0 AND WHERE o_id = #{oId} LIMIT 1")
	OrderGoodsDTO selectByOrder(@Param(value = "oId") Integer oId);

	List<OrderGoodsEntity> getGoodsDetailByOrderCode(@Param(value = "orderCode")String orderCode);
}